import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: "",
    onShow: true,
    userInfo: false,
  },
  getters: {
    getToken(state){
      return state.token || window.localStorage.getItem("token") || "";
    },
    getUserInfo(state) {
      return state.userInfo;
    }
  },
  mutations: {
    setToken(state,token) {
      state.token = token;
      localStorage.setItem('token', token);
    },
    delToken(state) {
      state.token = "";
      localStorage.removeItem("token");
    },
    setOnShow(state,getters) {
      state.onShow = getters;
    },
    setUserInfo(state,getters) {
      state.userInfo = getters;
    }
  },
  actions: {
  },
  modules: {
  },
  plugins: [

  ]
})
